﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="dealrequestdetail.aspx.vb" Inherits="task3.dealrequestdetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:ListView ID="ListView1" runat="server" 
        DataSourceID="AccessDataSource1"  >
        <EmptyDataTemplate>
            <span>No requests available.</span>
        </EmptyDataTemplate>
        
        <ItemTemplate>
        
        <h2><%# Eval("Title") %>
        </h2>
            <asp:Label ID="RequestedbyLabel" runat="server" 
                Text='<%# Eval("Requestedby") %>' />
            &nbsp;
            Posted Date:
            <asp:Label ID="PosteddateLabel" runat="server" 
                Text='<%# Eval("Posteddate") %>' />
                <br /><br />
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Eval("Description") %>' />
            <br />
            <br />
        </ItemTemplate>
    </asp:ListView>
    <p>
        <a href="dealrequestlist.aspx">Go back to All Deal Request</a></p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="AccessDataSource2">
            <Columns>
                <asp:BoundField DataField="Author" HeaderText="Author" 
                    SortExpression="Author" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Commentbody" HeaderText="Commentbody" 
                    SortExpression="Commentbody" />
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            
            SelectCommand="SELECT [Author], [Title], [Commentbody] FROM [Comments] WHERE (([Deal_fkID] = ?) AND ([table_ID] = ?))">
            <SelectParameters>
                <asp:QueryStringParameter Name="Deal_fkID" QueryStringField="ID" 
                    Type="Int32" DefaultValue="1" />
                <asp:Parameter DefaultValue="2" Name="table_ID" Type="Int32" />
            </SelectParameters>
        </asp:AccessDataSource>
    </p>
    <h3>Add Comment:</h3>
    <p>
        Title&nbsp;
        <asp:TextBox ID="tb_title" runat="server"></asp:TextBox>
        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
            ControlToValidate="tb_title" ErrorMessage="*"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:TextBox ID="tb_cb" runat="server" Height="122px" TextMode="MultiLine" 
            Width="752px"></asp:TextBox>
        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="tb_cb" ErrorMessage="*"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Button ID="b_Comment" runat="server" Text="AddComment" />
    </p>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/DealsDb.accdb" 
        
        SelectCommand="SELECT [Title], [Description], [Requestedby], [Posteddate] FROM [Dealrequest] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="ID" QueryStringField="ID" 
                Type="Int32" />
        </SelectParameters>
    </asp:AccessDataSource>

</asp:Content>
